2 # finish handling parameters for Sequence (in .py, ini, upload , save)
5 from tkinter
import X
, Y
, BOTTOM
, RIGHT
, LEFT
, HORIZONTAL
, END
, DISABLED
9 from oxsPpm
import ppmTypeBox
10 from oxsVario
import varioTypeBox
11 from oxsVoltage
import volt1PinBox
12 from oxsCurrent
import currentPinBox
13 from oxsRpm
import pulsesPerRotationBox
14 from oxsGps
import gpsRateBox
15 from oxsAirspeed
import airspeedTypeBox
17 from oxsMagnet
import *
20 from oxsLocator
import *
21 from oxsSequence
import *
22 from oxsMemory
import *
23 from oxsAddFields
import expAltTimeBox
24 from oxsFrsky
import frskyVfasBox
25 from oxsMultiplex
import MultiplexLine1Box
26 from oxsHott
import hottCellUndervoltageBox
27 from oxsJeti
import jetiVoltageSourceBox
30 from oxsConfig
import ttk
, W
, E
, BOTH
,nb
, HIDDEN
, root
, \
31 fMain
, fPpm
, fAdc
, fAirspeed
, fAnalogVario
, fCurrent
, fFlow
, fFrsky
,fGps
, fHott
, fImu
, fJeti
,\
32 fMagnet
, fMultiplex
, fRpm
, fLocator
, fSequence
, fMemory
, fVario
, fVoltage
, fAddFields
,\
33 ppmChanged
, ppmExist
, varioChanged
, varioExist
, voltageChanged
, voltageExist
, currentChanged
, currentExist
,\
34 gpsChanged
, gpsExist
, airspeedChanged
, airspeedExist
, rpmChanged
, rpmExist
, imuChanged
, imuExist
,magnetChanged
, magnetExist
, \
35 flowChanged
, flowExist
, adcChanged
, adcExist
, locatorExist
, locatorChanged
, sequenceChanged
, sequenceExist
, persistentExist
, persistentChanged
, \
36 addFieldsExist
, addFieldsChanged
, protocolVar
, protocolChanged
, pinToRxVar
, generateOxsConfig
, saveConfig
, uploadConfig
41 if win1
.state() == "normal": win1
.focus()
44 win1
.geometry("300x300+500+200")
46 #st = Pmw.ScrolledText( win1, borderframe=1, labelpos=E, label_text= "", usehullsize=1,
47 # hull_width=400, hull_height=300, text_padx=10, text_pady=10, text_wrap='none', text_state = 'disabled')
48 #st.pack(fill=BOTH, expand=1, padx=5, pady=5)
49 sy
= tk
.Scrollbar(win1
)
50 sx
= tk
.Scrollbar(win1
, orient
=HORIZONTAL
)
51 oxsDoc
= tk
.Text(win1
, height
=500, width
=300, wrap
='none')
52 sx
.pack(side
=BOTTOM
, fill
=X
)
53 sy
.pack(side
=RIGHT
, fill
=Y
)
54 oxsDoc
.pack(side
=LEFT
, fill
=Y
)
55 sy
.config(command
=oxsDoc
.yview
)
56 sx
.config(command
=oxsDoc
.xview
)
60 fileName
= r
"..\..\openXsensor\oXs_config_description.h"
62 f
= open(fileName
, "r")
63 oxsDoc
.insert(END
, f
.read() )
64 # st.settext( text = f.read() )
66 oxsDoc
.insert(END
, "File with docs not found")
67 # st.settext(text = "File with docs not found")
68 oxsDoc
.config(state
=DISABLED
)
70 def viewOxsConfigBasic():
73 if win1
.state() == "normal": win1
.focus()
76 win1
.geometry("300x300+500+200")
78 #st = Pmw.ScrolledText( win1, borderframe=1, labelpos=E, label_text= "", usehullsize=1,
79 # hull_width=400, hull_height=300, text_padx=10, text_pady=10, text_wrap='none', text_state = 'disabled')
80 #st.pack(fill=BOTH, expand=1, padx=5, pady=5)
81 sy
= tk
.Scrollbar(win1
)
82 sx
= tk
.Scrollbar(win1
, orient
=HORIZONTAL
)
83 oxsDoc
= tk
.Text(win1
, height
=500, width
=300, wrap
='none')
84 sx
.pack(side
=BOTTOM
, fill
=X
)
85 sy
.pack(side
=RIGHT
, fill
=Y
)
86 oxsDoc
.pack(side
=LEFT
, fill
=Y
)
87 sy
.config(command
=oxsDoc
.yview
)
88 sx
.config(command
=oxsDoc
.xview
)
92 fileName
= r
"oXs_config_basic.h"
94 f
= open(fileName
, "r")
95 oxsDoc
.insert(END
, f
.read() )
96 # st.settext( text = f.read() )
98 oxsDoc
.insert(END
, "File oXs_config_basic.h not found")
99 # st.settext(text = "File with docs not found")
100 oxsDoc
.config(state
=DISABLED
)
102 def viewOxsConfigAdvanced():
105 if win1
.state() == "normal": win1
.focus()
108 win1
.geometry("300x300+500+200")
110 #st = Pmw.ScrolledText( win1, borderframe=1, labelpos=E, label_text= "", usehullsize=1,
111 # hull_width=400, hull_height=300, text_padx=10, text_pady=10, text_wrap='none', text_state = 'disabled')
112 #st.pack(fill=BOTH, expand=1, padx=5, pady=5)
113 sy
= tk
.Scrollbar(win1
)
114 sx
= tk
.Scrollbar(win1
, orient
=HORIZONTAL
)
115 oxsDoc
= tk
.Text(win1
, height
=500, width
=300, wrap
='none')
116 sx
.pack(side
=BOTTOM
, fill
=X
)
117 sy
.pack(side
=RIGHT
, fill
=Y
)
118 oxsDoc
.pack(side
=LEFT
, fill
=Y
)
119 sy
.config(command
=oxsDoc
.yview
)
120 sx
.config(command
=oxsDoc
.xview
)
124 fileName
= r
"oXs_config_advanced.h"
126 f
= open(fileName
, "r")
127 oxsDoc
.insert(END
, f
.read() )
128 # st.settext( text = f.read() )
130 oxsDoc
.insert(END
, "File oXs_config_advanced.h not found")
131 # st.settext(text = "File with docs not found")
132 oxsDoc
.config(state
=DISABLED
)
136 ttk
.Label(fMain
, text
="Components (details to be filled in tabs)").grid( row
=0 , pady
=(10,2)) #column=0 , sticky=(N,W,E,S)
137 ttk
.Checkbutton(fMain
, text
='Ppm', command
=ppmChanged
, variable
=ppmExist
,
138 onvalue
='On', offvalue
='Off').grid(row
=1, sticky
=(W
,E
), padx
=20 , pady
=5)
139 ttk
.Checkbutton(fMain
, text
='Vario', command
=varioChanged
, variable
=varioExist
,
140 onvalue
='On', offvalue
='Off').grid(row
=2, sticky
=(W
,E
), padx
=20 , pady
=5)
141 ttk
.Checkbutton(fMain
, text
='Voltages', command
=voltageChanged
, variable
=voltageExist
,
142 onvalue
='On', offvalue
='Off').grid(row
=3, sticky
=(W
,E
), padx
=20 , pady
=5)
143 ttk
.Checkbutton(fMain
, text
='Current', command
=currentChanged
, variable
=currentExist
,
144 onvalue
='On', offvalue
='Off').grid(row
=4, sticky
=(W
,E
), padx
=20 , pady
=5)
145 ttk
.Checkbutton(fMain
, text
='GPS', command
=gpsChanged
, variable
=gpsExist
,
146 onvalue
='On', offvalue
='Off').grid(row
=5, sticky
=(W
,E
), padx
=20 , pady
=5)
147 ttk
.Checkbutton(fMain
, text
='Airspeed', command
=airspeedChanged
, variable
=airspeedExist
,
148 onvalue
='On', offvalue
='Off').grid(row
=6, sticky
=(W
,E
), padx
=20 , pady
=5)
149 ttk
.Checkbutton(fMain
, text
='Rpm', command
=rpmChanged
, variable
=rpmExist
,
150 onvalue
='On', offvalue
='Off').grid(row
=7, sticky
=(W
,E
), padx
=20 , pady
=5)
151 ttk
.Checkbutton(fMain
, text
='Acc/Gyro (IMU6050)', command
=imuChanged
, variable
=imuExist
,
152 onvalue
='On', offvalue
='Off').grid(row
=8, sticky
=(W
,E
), padx
=20 , pady
=5)
153 ttk
.Checkbutton(fMain
, text
='Magn. (HMC5883)', command
=magnetChanged
, variable
=magnetExist
,
154 onvalue
='On', offvalue
='Off').grid(row
=9, sticky
=(W
,E
), padx
=20 , pady
=5)
155 ttk
.Checkbutton(fMain
, text
='Flow sensor', command
=flowChanged
, variable
=flowExist
,
156 onvalue
='On', offvalue
='Off').grid(row
=10, sticky
=(W
,E
), padx
=20 , pady
=5)
157 ttk
.Checkbutton(fMain
, text
='External ADC (ADS1115)', command
=adcChanged
, variable
=adcExist
,
158 onvalue
='On', offvalue
='Off').grid(row
=11, sticky
=(W
,E
), padx
=20 , pady
=5)
159 ttk
.Checkbutton(fMain
, text
='Locator', command
=locatorChanged
, variable
=locatorExist
,
160 onvalue
='On', offvalue
='Off').grid(row
=12, sticky
=(W
,E
), padx
=20 , pady
=5)
161 ttk
.Checkbutton(fMain
, text
='Sequencer', command
=sequenceChanged
, variable
=sequenceExist
,
162 onvalue
='On', offvalue
='Off').grid(row
=13, sticky
=(W
,E
), padx
=20 , pady
=5)
163 ttk
.Checkbutton(fMain
, text
='Persistent Memory', command
=persistentChanged
, variable
=persistentExist
,
164 onvalue
='On', offvalue
='Off').grid(row
=14, sticky
=(W
,E
), padx
=20 , pady
=5)
165 ttk
.Checkbutton(fMain
, text
='Extra fields (TEST 1,2,3)', command
=addFieldsChanged
, variable
=addFieldsExist
,
166 onvalue
='On', offvalue
='Off').grid(row
=15, sticky
=(W
,E
), padx
=20 , pady
=5)
168 ttk
.Label(fMain
, text
="Protocol of Rx").grid(column
=0, row
=16, pady
=(20,2))
169 protocolBox
= ttk
.Combobox(fMain
, textvariable
=protocolVar
, state
= 'readonly' ,
170 values
=('FRSKY_SPORT', 'JETI', 'HOTT', 'MULTIPLEX', 'FRSKY_HUB' , 'FRSKY_SPORT_HUB'))
171 protocolBox
.bind('<<ComboboxSelected>>', protocolChanged
)
172 protocolBox
.grid(column
=1, row
=16, pady
=(20,2) )
174 ttk
.Label(fMain
, text
="Pin used for telemetry").grid(column
=0, row
=17, pady
=(5,2))
175 pinToRxBox
= ttk
.Combobox(fMain
, textvariable
=pinToRxVar
,
176 values
=('4', '2'), state
='readonly', width
=2)
177 pinToRxBox
.grid(column
=1, row
=17, pady
=(5,2))
179 nb
.add(fMain
, text
='Main')
180 nb
.add(fPpm
, text
='Ppm', state
=HIDDEN
)
181 nb
.add(fVario
, text
='Vario', state
=HIDDEN
)
182 nb
.add(fVoltage
, text
='Voltages', state
=HIDDEN
)
183 nb
.add(fCurrent
, text
='Current', state
=HIDDEN
)
184 nb
.add(fGps
, text
='GPS', state
=HIDDEN
)
185 nb
.add(fAirspeed
, text
='Airspeed', state
=HIDDEN
)
186 nb
.add(fRpm
, text
='Rpm', state
=HIDDEN
)
187 nb
.add(fImu
, text
='Acc/Gyro (IMU6050)', state
=HIDDEN
)
188 nb
.add(fMagnet
, text
='Magnet (HMC5883)', state
=HIDDEN
)
189 nb
.add(fFlow
, text
='Flow', state
=HIDDEN
)
190 nb
.add(fAdc
, text
='ADC', state
=HIDDEN
)
191 nb
.add(fLocator
, text
='Locator' , state
=HIDDEN
)
192 nb
.add(fSequence
, text
='Sequencer', state
=HIDDEN
)
193 nb
.add(fMemory
, text
='Persistent Memory', state
=HIDDEN
)
194 nb
.add(fAddFields
, text
= 'Extra Fields' , state
=HIDDEN
)
195 nb
.add(fFrsky
, text
='FRSKY', state
='normal')
196 nb
.add(fJeti
, text
='JETI', state
=HIDDEN
)
197 nb
.add(fHott
, text
='HOTT', state
=HIDDEN
)
198 nb
.add(fMultiplex
, text
='MULTIPLEX', state
=HIDDEN
)
201 fMainRight
= ttk
.Frame(fMain
)
202 fMainRight
.grid(column
=3 , row
=0, rowspan
=15)
203 ttk
.Label(fMainRight
, text
="-Select components\n-Select protocol\n-Fill tab(s)\n or\n-Upload a Config\n\n-Generate oXs config").grid(column
=0, row
=0, pady
=(20,2))
204 ttk
.Button(fMainRight
, text
='Upload Config', command
=uploadConfig
).grid(column
=0, row
=1, pady
=10)
205 ttk
.Button(fMainRight
, text
='Save Config', command
=saveConfig
).grid(column
=0, row
=2, pady
=10)
206 ttk
.Button(fMainRight
, text
='Generate oXs Config', command
=generateOxsConfig
).grid(column
=0, row
=4, pady
=30)
207 ttk
.Button(fMainRight
, text
='View oXs_config_basic.h', command
=viewOxsConfigBasic
).grid(column
=0, row
=5, pady
=10)
208 ttk
.Button(fMainRight
, text
='View oXs_config_advanced.h', command
=viewOxsConfigAdvanced
).grid(column
=0, row
=6, pady
=10)
209 ttk
.Button(fMainRight
, text
='View oXs doc', command
=viewOxsDoc
).grid(column
=0, row
=7, pady
=30)